package com.hb.trade.server.flow.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hb.core.pojo.flow.mapper.FlowTempFormFieldMapper;
import com.hb.core.pojo.flow.entity.FlowTempFormField;
import com.hb.trade.server.flow.service.FlowTempFormFieldService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 流程表单信息(模板) 服务实现类
 * </p>
 *
 * @author zhaojk
 * @since 2021-05-27
 */
@Service
public class FlowTempFormFieldServiceImpl extends ServiceImpl<FlowTempFormFieldMapper, FlowTempFormField> implements FlowTempFormFieldService {

    @Override
    public boolean saveFormTempFields(Long formId, List<FlowTempFormField> fields) {
        if (CollUtil.isEmpty(fields)) {
            return false;
        }
        for (FlowTempFormField field : fields) {
            field.setFormId(formId);
            save(field);
        }
        return true;
    }
}
